package com.ming.collection;

import java.util.*;
import java.util.stream.IntStream;

public class TreeSetDemo {
    public static void main(String[] args) {
//        List<int[]> ints = allPut(new int[]{1, 2, 3, 4});
//        for (int[] anInt : ints) {
//            for (int i : anInt) {
//                System.out.print(i + " ");
//            }
//            System.out.println();
//        }
    }



    /*
    private static List<int[]> allPut(int[] ints) {
        ArrayList<int[]> result = new ArrayList<>();
        for (int i = 0; i < ints.length; i++) {
            for (int j = i + 1; j < ints.length; j++) {
                int[] element = ints.clone();
                element[i] ^= element[j];
                element[j] ^= element[i];
                element[i] ^= element[j];
                result.add(element);
                int[] element1 = ints.clone();
                invertUsingFor(element1);
                element1[i] ^= element1[j];
                element1[j] ^= element1[i];
                element1[i] ^= element1[j];
                result.add(element1);
            }
        }
        return result;
    }
     */


    private static void invertUsingFor(int[] array) {
        for (int i = 0; i < array.length / 2; i++) {
            int temp = array[i];
            array[i] = array[array.length - 1 - i];
            array[array.length - 1 - i] = temp;
        }
    }
}
